var dokArray = document.assocs["rcc:resAttachments"];
var person = document.assocs["rcc:resRegistrator"][0];
var name = person.properties["{http://www.alfresco.org/model/content/1.0}firstName"];
var lname = person.properties["{http://www.alfresco.org/model/content/1.0}lastName"];
var registrator = name+" "+lname;
var dok = null;
if (dokArray!=null){
	for (var i=0;i<dokArray.length;i++){
		dok = document.assocs["rcc:resAttachments"][i];
		if (dok.type!="{http://appdevel?.kada.lt/model/content/1.0}veiklosDokumentas") dok.specializeType("rcc:veiklosDokumentas");
		dok.properties["rcc:dokRegNum"] = document.properties["rcc:resRegNumber"];
		dok.properties["rcc:dokRegDat"] = document.properties["rcc:resRegDate"];
		dok.properties["rcc:dokSenderRegNum"] = document.properties["rcc:resSendRegNumber"];
		dok.properties["rcc:dokSenderRegDat"] = document.properties["rcc:resSendDate"];	
		dok.properties["rcc:grup"] = "Gauta";
		dok.properties["cm:title"] = document.properties["rcc:resSendTitle"];
		dok.properties["rcc:dokRegAsmVarPav"] = registrator;
		dok.properties["rcc:dokSiunKod"] = document.properties["rcc:resSendKod"];
		dok.properties["rcc:dokSiunPav"] = document.properties["rcc:resSendName"];
		dok.properties["rcc:dokSiunRcPav"] = document.properties["rcc:resSendRcPav"];
		dok.properties["rcc:dokSiunPad"] = document.properties["rcc:resSendPad"];
		dok.properties["rcc:dokSiunRcPad"] = document.properties["rcc:resSendRcPad"];
		dok.properties["rcc:adresatas"] = document.properties["rcc:sendResName"];
		dok.properties["rcc:dokGautPast"] = document.properties["rcc:resNote"];
		dok.save();
	}
}